import { User } from 'src/modules/system/user/entities/user.entity';
import {
  Entity,
  PrimaryGeneratedColumn,
  Column,
  OneToOne,
  ManyToOne,
  OneToMany,
  ManyToMany,
  JoinTable,
} from 'typeorm';

@Entity('sys_depart')
export class Dept {
  @PrimaryGeneratedColumn('uuid')
  Id: string;
  @Column()
  name: string; // 部门/班组名称
  @Column()
  category: string; // 分类
  @Column()
  type: string; // 业务类型
  @Column({ default: 0 })
  deleted: number; // 删除标志，1为未删除，0为已删除
  @OneToMany(() => User, (user) => user.Dept)
  Users: User[]; // 公司下的用户列表
  @Column({
      type: 'timestamp',
      default: () => 'CURRENT_TIMESTAMP',
  })
  createTime: Date;
  
  @Column({
      type: 'timestamp',
      default: () => 'CURRENT_TIMESTAMP',
      onUpdate: 'CURRENT_TIMESTAMP',
  })
  updateTime: Date;
  @Column()
  createBy: string;
  @Column()
  updateBy: string;
}
